function newGoods(tmp){	
	
	if(tmp=='o'){
		var row = $('#tt').datagrid('getSelected');
		if (row) {
			greyLayer.open();
			win_func.window('open');
			form_func.form('clear');
			$("#goods_file").val('');
			$("#method").val('modify');
			form_func.url = proName+'/casePropertyManager/save';
			//这里应该可以控制TBODY的显示，通过发送ajax请求，返回json串，将json值写入到页面中
			var controllers = $('#disabled_Tbody input');
			for(var i=0;i<controllers.length;i++){
				controllers[i].disabled='true';
			}
			$('#GOODS_TYPE').show().next().remove();
			$("#GOODS_KIND").show().next().remove();
			$("#AJLB").show().next().remove();
			$("#AJZT").show().next().remove();
			
			
			var goodsName = row.goods_name;			
			$("#GOODS_NAME").val(goodsName);
			var goodsType = row.goods_typeDesc;			
			$("#GOODS_TYPE").val(goodsType);  
			var goodsKind = row.goods_kindDesc;    
			$("#GOODS_KIND").val(goodsKind);  
			var goodsValue = row.goods_values;			
			$("#GOODS_VALUES").val(goodsValue); 
			var caseName = row.case_name;			
			$("#AJMC").val(caseName);               
			var caseType = row.case_typeDesc;			
			$("#AJLB").val(caseType);	          
			var case_status = row.case_statusDesc;			
			$("#AJZT").val(case_status);  
			var goodsValue = row.goods_value;			
			$("#JYAQ").val(goodsValue);         
			$("#h_goods_id").val(row.goods_id);
			var goods_kind = row.goods_kind;
			var newValue = '01';
			if(goods_kind==null){	//一般物品
				newValue = '01';	
			}else if (goods_kind=='B'){	//车辆
				newValue = '13';
			}else if(goods_kind=='E'){ //文物
				newValue = '05';
			}else if(goods_kind=='X'){ //现金
				newValue = '02';
			}else if(goods_kind=='L' ||goods_kind=='U' ||goods_kind=='V' ){//影音
				newValue = '06';
			}
			$('#h_goods_kind').val(newValue);
			$('#TBODY_01').hide();
			$('#TBODY_02').hide();
			$('#TBODY_05').hide();
			$('#TBODY_06').hide();
			$('#TBODY_13').hide();
			
        	var newID = 'TBODY_'+newValue;
        	$('#TBODY_01').hide();
        	$('#'+newID).show();
        	$.post(proName+"/casePropertyStorage/getCabinet?shelf_id="+newValue,function(result){
        		
        	});
		} else {
			sys_alert('错误提示', '选择一个要操作的物品', 'error');
			return ;
		} 
		
	}else{
		greyLayer.open();
		win_func.window('open');
		form_func.form('clear');
		$("#method").val('add');
		form_func.url = proName+'/casePropertyManager/save';
		$('#TBODY_01').show();
		$('#TBODY_02').hide();
		$('#TBODY_05').hide();
		$('#TBODY_06').hide();
		$('#TBODY_13').hide();
		var controllers = $('#disabled_Tbody input');
		for(var i=0;i<controllers.length;i++){
			controllers[i].disabled='';
		}
		$('#GOODS_KIND').combobox({ 
			url:proName+"/dicManager/getChildListByPcode?p_code=4",
			multiple:false,
			setValue:'01', 
			setText:'一般物品',
	        onChange:function(newValue,oldValue){  
	        	
	        	if(oldValue==''){
	        		oldValue = '01';
	        	}
	        	if( newValue=='03' || newValue=='04' || newValue=='08' || newValue=='11' || newValue=='09' || newValue=='10' || newValue=='12'){
	        		newValue = '01';
	        	}
	        	var oldID = 'TBODY_'+oldValue;
	        	var newID = 'TBODY_'+newValue;
	        	$('#'+oldID).hide();
	        	$('#'+newID).show();
	        	var newWptz = newID+'_WPTZ';
	        	var newWptzValue = $('#'+newWptz).val();
	        	var prop_desc = $('#prop_desc');
				prop_desc.val(newWptzValue); 
	        }  
	    	}); 
	    	
	    	$('#GOODS_TYPE').next().children()[0].style.width=($('#GOODS_TYPE').width()-18)+'px';
	    	$('#GOODS_TYPE')[0].style.display='none';
	    	
	    	$('#AJLB').next().children()[0].style.width=($('#AJLB').width()-18)+'px';
	    	$('#AJLB')[0].style.display='none';
	    	
	    	$('#AJZT').next().children()[0].style.width=($('#AJZT').width()-18)+'px';
	    	$('#AJZT')[0].style.display='none';

	    	$('#GOODS_KIND').next().children()[0].style.width=($('#GOODS_KIND').width()-18)+'px';
	    	$('#GOODS_KIND')[0].style.display='none';
	}
	 
}
function myKeyUp(obj){
	var prop_desc = $('#prop_desc');
	prop_desc.val(obj.value);
}
function oGoods(){
	newGoods('o');
}
function nGoods(){
	newGoods('n');
}
function reset(){
	$('#queryForm').form('clear');
}
//查询方法,修改表格得查询条件
function search(){
	var queryParams = $('#tt').datagrid('options').queryParams;
	//type用来在后台判断是否点击按钮提交
	queryParams["type"] = 'search';
	//把页面中form 查询条件在这里补齐，queryParams["AJBH"] 的AJBH是提交得名字通过request.getParameter("AJBH")获得值,同jquery 发送ajax请求类似
	queryParams["AJBH"] = $('#AJBH').val();
	queryParams["AJLB"] = $('#AJLB_S').val();
	queryParams["AJMC"] = $('#AJMC').val();
	queryParams["WPSBDW"] = $('#WPSBDW').val();
	queryParams["WPSBR"] = $('#WPSBR').val();
	queryParams["SBSJ"] = $('#SBSJ').val();
	$('#tt').datagrid('options').pageNumber = 1;
	$('#tt').datagrid('reload');
}

function save() {
	if (form_func.form('validate')) {
		form_func.form('submit', {
			url : form_func.url,
			success : function(data) {
				eval('data=' + data);
				//alert(data.success);
				if (data.success) {
					sys_alert('保存成功','请在涉案物品入库登记中填写入库信息','info');
					grid.datagrid('reload');
					
					win_func.window('close');
					greyLayer.close();
					grid.datagrid('clearSelections');
				} else {
					sys_alert('错误提示', data.msg, 'error');
				}
			}
		});
	}
}